/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package systole.view.wizard.analysis;

import systole.view.wizard.PageController;
import systole.view.wizard.WizardResult;

/**
 *
 * @author jmj
 */
public class SecondPageController extends PageController {

    public static final String KEY = "SECOND_PAGE";
    private JPnlSecondPage page;

    public SecondPageController() {
        super();
    }

    @Override
    public String validatePage() {
        return this.getPage().validateConditions();
    }

    /**
     * @return the page
     */
    public JPnlSecondPage getPage() {
        if (this.page == null) {
            this.page = new JPnlSecondPage();
        }
        return page;
    }

    @Override
    public boolean hasNext() {
        return true;
    }

    @Override
    public boolean hasLast() {
        return true;
    }

    @Override
    public String getKey() {
        return KEY;
    }

    @Override
    public boolean pageInitialized() {
        return this.page != null;
    }

    @Override
    public WizardResult loadResult(WizardResult result) {
        result.putObjet("medic", this.page.getMedicSelected());
        result.putObjet("patient", this.page.getPatientSelected());
        return result;
    }
}
